using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.UI.DataVisualization.Charting;

namespace System.Web.UI.DataVisualization.Charting.Samples
{
	/// <summary>
	/// Summary description for WebForm1.
	/// </summary>
	public partial class AreaChart : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label Label1;

	
		protected void Page_Load(object sender, System.EventArgs e)
		{
			// Add data
			Chart1.Series["Series1"].Points.AddY(8.1);
			Chart1.Series["Series1"].Points.AddY(7.6);
			Chart1.Series["Series1"].Points.AddY(9.5);
			Chart1.Series["Series1"].Points.AddY(8.5);
			Chart1.Series["Series1"].Points.AddY(9.0);
			Chart1.Series["Series1"].Points.AddY(8.0);

			Chart1.Series["Series2"].Points.AddY(2.3);
			Chart1.Series["Series2"].Points.AddY(4.2);
			Chart1.Series["Series2"].Points.AddY(3.6);
			Chart1.Series["Series2"].Points.AddY(2.3);
			Chart1.Series["Series2"].Points.AddY(1.6);
			Chart1.Series["Series2"].Points.AddY(2.9);

			if(Area.Checked)
			{
				// Set chart type to Area
				Chart1.Series["Series1"].ChartType = SeriesChartType.Area;
				Chart1.Series["Series2"].ChartType = SeriesChartType.Area;
				LineTensionList.Enabled = false;
			}
			else if (SplineArea.Checked)
			{
				// Set chart type to SplineArea and set line tension
				LineTensionList.Enabled = true;
				Chart1.Series["Series1"].ChartType = SeriesChartType.SplineArea;
				Chart1.Series["Series1"]["LineTension"] = LineTensionList.SelectedItem.Text;
				Chart1.Series["Series2"].ChartType = SeriesChartType.SplineArea;
				Chart1.Series["Series2"]["LineTension"] = LineTensionList.SelectedItem.Text;
			}

			// Enable points labels and markers
			if(ShowLabels.Checked)
			{
				Chart1.Series["Series1"].IsValueShownAsLabel = true;
				Chart1.Series["Series1"].MarkerStyle = MarkerStyle.Circle;
				Chart1.Series["Series1"].MarkerColor = Color.Aqua;
				Chart1.Series["Series2"].IsValueShownAsLabel = true;
				Chart1.Series["Series2"].MarkerStyle = MarkerStyle.Circle;
				Chart1.Series["Series2"].MarkerColor = Color.Magenta;
			}

			// Disable/enable X axis margin
			Chart1.ChartAreas["ChartArea1"].AxisX.IsMarginVisible = ShowMargins.Checked;
			
			// Show as 2D or 3D
			if(Show3D.Checked)
			{
				Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;				
			}
			else
			{
				Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = false;
			}
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    

		}
		#endregion		
	}
}
